package rsj.sql.remind;

import com.rlyy.aibase.utils.base.MapNode;
import com.rlyy.aibase.utils.base.Node;
import com.rlyy.aibase.utils.base.TableNode;
import rsj.annotation.Param;
import rsj.annotation.Select;
import rsj.annotation.Update;
import rsj.api.remind.entity.RemindTable;

/**
 * @author : shibixiao
 * @description :
 * @date : 2021-07-19 16:55
 **/
public interface RemindDao {


    @Update(value = "INSERT INTO sys.sys_remind (remind_id,remind_type,remind_mode,remind_cond,remind_freq,remind_num" +
            ",receive_user_id,remind_template,remind_open,update_tm) VALUES (#{remindId},#{remindType},#{remindMode},#{remindCond}" +
            ",#{remindFreq},#{remindNum},#{receiveUserId},#{remindTemplate},#{remindOpen},#{updateTm})")
    void addRemindInfo(RemindTable remindTable);

    @Update(value = "UPDATE sys.sys_remind SET " +
            "remind_type = #{remindType}, remind_mode = #{remindMode}, remind_cond = #{remindCond}, remind_freq = #{remindFreq}, " +
            "remind_num = #{remindNum}, receive_user_id = #{receiveUserId}, remind_template = #{remindTemplate}, " +
            "remind_open = #{remindOpen}, update_tm = #{updateTm} WHERE remind_id = #{remindId}")
    void updateRemindInfo(RemindTable remindTable);

    @Select(value = "SELECT remind_id,remind_open,remind_type,remind_mode,remind_cond,remind_freq,remind_num,receive_user_id,remind_template " +
            " FROM sys.sys_remind WHERE remind_type = #{remindType} ")
    MapNode getRemindInfoByType(@Param("remindType") String remindType);
}
